﻿<phone:PhoneApplicationPage 
    x:Class="Boxi.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True" BackKeyPress="PhoneApplicationPage_BackKeyPress" Loaded="PhoneApplicationPage_Loaded">

    <Grid x:Name="LayoutRoot" Background="Transparent" DataContext="{Binding Instance, Source={StaticResource PersistentSettingsDataSource}}" Grid.Row="1" Margin="0,0,0,0">
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="120" />
            <RowDefinition Height="75"/>
            <RowDefinition Height="522"/>
            <RowDefinition Height="100"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Image x:Name="imgParchment" Source="Parchment.jpg" Grid.Row="0" Grid.Column="0" Grid.RowSpan="5" Margin="-140,-200,0,0" Width="800" Height="2000" Visibility="Collapsed" />

        <Grid HorizontalAlignment="Center" Grid.Column="0" Grid.Row="1" Margin="20,5,20,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="50" />
                <ColumnDefinition Width="150" />
                <ColumnDefinition Width="70" />
                <ColumnDefinition Width="70" />
                <ColumnDefinition Width="70" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="20" />
                <RowDefinition Height="20" />
                <RowDefinition Height="20" />
            </Grid.RowDefinitions>

            <TextBlock Grid.Row="0" FontSize="14" Grid.Column="1" Foreground="Gray" x:Name="txtNameHeader">Player</TextBlock>
            <TextBlock Grid.Row="0" FontSize="14"  Foreground="Gray" Grid.Column="2">Turn</TextBlock>
            <TextBlock Grid.Row="0" FontSize="14"  Foreground="Gray" Grid.Column="3">Moves</TextBlock>
            <TextBlock Grid.Row="0" FontSize="14" Foreground="Gray"  Grid.Column="34">Score</TextBlock>

            <Rectangle Grid.Row="1" Grid.Column="0" x:Name="rclActive1" Width="30" Height="12" />
            <TextBlock Grid.Row="1" FontSize="14" FontWeight="Bold" Grid.Column="1" x:Name="txtName1">Me</TextBlock>
            <TextBlock Grid.Row="1" FontSize="14"  Grid.Column="2" x:Name="txtTurn1">0</TextBlock>
            <TextBlock Grid.Row="1" FontSize="14"  Grid.Column="3" x:Name="txtMoves1">0</TextBlock>
            <TextBlock Grid.Row="1" FontSize="14"  Grid.Column="4" x:Name="txtScore1">0</TextBlock>

            <Rectangle Grid.Row="2" Grid.Column="0" x:Name="rclActive2" Width="30" Height="12" />
            <TextBlock Grid.Row="2" FontSize="14" FontWeight="Bold" Grid.Column="1" x:Name="txtName2">Compter</TextBlock>
            <TextBlock Grid.Row="2" FontSize="14"  Grid.Column="2" x:Name="txtTurn2">0</TextBlock>
            <TextBlock Grid.Row="2" FontSize="14"  Grid.Column="3" x:Name="txtMoves2">0</TextBlock>
            <TextBlock Grid.Row="2" FontSize="14"  Grid.Column="4" x:Name="txtScore2">0</TextBlock>
        </Grid>

        <Canvas Margin="20,0,0,0" Grid.Row="2" Grid.Column="0" x:Name="cvsMain" Canvas.ZIndex="0" ></Canvas>
            
        <Rectangle Grid.Row="0" Grid.Column="0" Grid.RowSpan="5" x:Name="rclOverlay" Opacity="0.72" Fill="Black" Margin="0,-20,0,0" Width="480" Height="800" Visibility="Collapsed"></Rectangle>
        <Image x:Name="imgParchmentOverlay" Source="Parchment.jpg" Opacity="0.72"  Grid.Row="0" Grid.Column="0" Grid.RowSpan="5" Margin="-140,-200,0,0" Width="800" Height="2000" Visibility="Collapsed"/>

        <StackPanel Grid.Column="0" Grid.Row="0" x:Name="TitlePanel" Margin="12,17,0,0" DataContext="{Binding}">
            <TextBlock x:Name="ApplicationTitle" Text="Michael Kappel, MCPD" Style="{StaticResource PhoneTextNormalStyle}"/> 
            <TextBlock x:Name="PageTitle" Text="Boxi" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        
        <StackPanel Grid.Row="2" Grid.Column="0" Orientation="Vertical" x:Name="spPause" Visibility="Collapsed" Width="423">
            <Button Background="{Binding Path=AccentBrush}" Foreground="{Binding Path=SecondaryAccentBrush}" BorderBrush="{Binding Path=SecondaryAccentBrush}" x:Name="btnStartNewGame" FontSize="16" Click="btnStartNewGame_Click" Canvas.ZIndex="1100" Content="Start New Game"></Button>
            <Button Background="{Binding Path=AccentBrush}" Foreground="{Binding Path=SecondaryAccentBrush}" BorderBrush="{Binding Path=SecondaryAccentBrush}" x:Name="btnContinueGame" FontSize="16" Click="btnContinueGame_Click" Canvas.ZIndex="1100" Content="Continue Current Game"></Button>
            <Button Background="{Binding Path=AccentBrush}" Foreground="{Binding Path=SecondaryAccentBrush}" BorderBrush="{Binding Path=SecondaryAccentBrush}" x:Name="btnbtnQuitGame" FontSize="16" Click="btnbtnQuitGame_Click" Canvas.ZIndex="1100" Content="Quit Game"></Button>
        </StackPanel>
            
        <Grid Grid.Row="2" x:Name="spNewGame" Grid.RowSpan="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="100" />
                <ColumnDefinition Width="170" />
                <ColumnDefinition Width="260" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="60" />
                <RowDefinition Height="70" />
                <RowDefinition Height="70" />
                <RowDefinition Height="70" />
                <RowDefinition Height="90" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" x:Name="txtYouWin" Canvas.ZIndex="1100" FontSize="40" Visibility="Collapsed">You Win!</TextBlock>
            <TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2" x:Name="txtYouLost" FontSize="40" Canvas.ZIndex="1100"  Visibility="Collapsed">You Lost!</TextBlock>
            <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="0" Grid.Row="1" Margin="0,0,5,0">Rows:</TextBlock>
            <ComboBox VerticalAlignment="Center" Height="40" FontSize="24" Width="150" HorizontalAlignment="Left" Grid.Column="1" Grid.Row="1" SelectionChanged="lbxSize_SelectionChanged"  x:Name="lbxSizeY" Canvas.ZIndex="1100" >
                <ComboBoxItem Padding="5,7,5,7" Content="3" />
                <ComboBoxItem Padding="5,7,5,7" Content="4" />
                <ComboBoxItem Padding="5,7,5,7" Content="5" />
                <ComboBoxItem Padding="5,7,5,7" Content="6" />
                <ComboBoxItem Padding="5,7,5,7" Content="7" IsSelected="True" />
                <ComboBoxItem Padding="5,7,5,7" Content="8"/>
                <ComboBoxItem Padding="5,7,5,7" Content="9" />
                <ComboBoxItem Padding="5,7,5,7" Content="10" />
                <ComboBoxItem Padding="5,7,5,7" Content="11" />
                <ComboBoxItem Padding="5,7,5,7" Content="12" />
            </ComboBox>
            <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="0" Grid.Row="2" Margin="0,0,5,0">Columns:</TextBlock>
            <ComboBox VerticalAlignment="Center" Height="40" FontSize="24"  Width="150" HorizontalAlignment="Left" Grid.Column="1" Grid.Row="2" SelectionChanged="lbxSize_SelectionChanged" x:Name="lbxSizeX" Canvas.ZIndex="1100" >
                <ComboBoxItem Padding="5,10,5,10" Content="3" />
                <ComboBoxItem Padding="5,10,5,10" Content="4" />
                <ComboBoxItem Padding="5,10,5,10" Content="5" IsSelected="True" />
                <ComboBoxItem Padding="5,10,5,10" Content="6" />
                <ComboBoxItem Padding="5,10,5,10" Content="7" />
                <ComboBoxItem Padding="5,10,5,10" Content="8" />
                <ComboBoxItem Padding="5,10,5,10" Content="9" />
            </ComboBox>
            <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="0" Grid.Row="3" Margin="0,0,5,0">Difficulty:</TextBlock>
            <ComboBox VerticalAlignment="Center" Height="40" FontSize="24"  Width="150" HorizontalAlignment="Left" Grid.Column="1" Grid.Row="3" SelectionChanged="lbxSize_SelectionChanged" x:Name="lbxDifficulty" Canvas.ZIndex="1100" >
                <ComboBoxItem Padding="5,10,5,10" Content="Easy" IsSelected="True" />
                <ComboBoxItem Padding="5,10,5,10" Content="Moderate" />
                <ComboBoxItem Padding="5,10,5,10" Content="Difficult" />
            </ComboBox>
            <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="0" Grid.Row="4" Margin="0,0,5,0">Style:</TextBlock>
            <ComboBox VerticalAlignment="Center" Height="40" FontSize="24"  Width="150" HorizontalAlignment="Left"  Grid.Column="1" Grid.Row="4" SelectionChanged="lbxSize_SelectionChanged"  x:Name="lbxLayout" Canvas.ZIndex="1100" >
                <ComboBoxItem Padding="5,10,5,10" Content="Arcade"  IsSelected="True"  />
                <ComboBoxItem Padding="5,10,5,10" Content="Traditional" />
            </ComboBox>
            <StackPanel Grid.Row="1" Grid.Column="2" Grid.RowSpan="5" Margin="0,0,63,0">
                <Button Background="{Binding Path=AccentBrush}" Foreground="{Binding Path=SecondaryAccentBrush}" BorderBrush="{Binding Path=SecondaryAccentBrush}" x:Name="btnStartGame" FontSize="16" Click="btnStartGame_Click" Canvas.ZIndex="1100" Content="Start New Game"></Button>
                <Button Background="{Binding Path=AccentBrush}" Foreground="{Binding Path=SecondaryAccentBrush}" BorderBrush="{Binding Path=SecondaryAccentBrush}" x:Name="btnContinueGameFromNew" FontSize="16" Click="btnContinueGame_Click" Canvas.ZIndex="1100" Content="Continue Game" Visibility="Collapsed"></Button>
                <Button Background="{Binding Path=AccentBrush}" Foreground="{Binding Path=SecondaryAccentBrush}" BorderBrush="{Binding Path=SecondaryAccentBrush}" x:Name="btnSettings" FontSize="16" Click="btnSettings_Click" Canvas.ZIndex="1100" Content="Settings"></Button>
                <Button Background="{Binding Path=AccentBrush}" Foreground="{Binding Path=SecondaryAccentBrush}" BorderBrush="{Binding Path=SecondaryAccentBrush}" x:Name="btnInstructions" FontSize="16" Click="btnInstructions_Click" Canvas.ZIndex="1100" Content="Instructions"></Button>
                <Button Background="{Binding Path=AccentBrush}" Foreground="{Binding Path=SecondaryAccentBrush}" BorderBrush="{Binding Path=SecondaryAccentBrush}" x:Name="btnAbout" FontSize="16" Click="btnAbout_Click" Canvas.ZIndex="1100" Content="About"></Button>
            </StackPanel>

            <Grid HorizontalAlignment="Left" Grid.Column="0" Grid.Row="5" Grid.ColumnSpan="3" Margin="30,5,20,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="120" />
                    <ColumnDefinition Width="300" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="40" />
                    <RowDefinition Height="30" />
                    <RowDefinition Height="60" />
                    <RowDefinition Height="60" />
                </Grid.RowDefinitions>
                <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3">Players</TextBlock>
                <Button Background="{Binding Path=AccentBrush}" Foreground="{Binding Path=SecondaryAccentBrush}" BorderBrush="{Binding Path=SecondaryAccentBrush}" Margin="0,-8,-16,-8" Grid.Row="0" Grid.Column="1" x:Name="btnRunTests" FontSize="16" Click="btnRunTests_Click" Canvas.ZIndex="1100" Content="Run Tests" Visibility="Collapsed"></Button>

                <TextBlock Grid.Row="1" Grid.Column="0">Type</TextBlock>
                <TextBlock Grid.Row="1" Grid.Column="1">Name</TextBlock>

                <ComboBox FontSize="18"  Margin="0,10,0,10" Grid.Row="2" Grid.Column="0" SelectionChanged="lbxPlayer1Type_SelectionChanged" x:Name="lbxPlayer1Type" Canvas.ZIndex="1400" >
                    <ComboBoxItem Padding="5,10,5,10" Content="Human" IsSelected="True" />
                    <ComboBoxItem Padding="5,10,5,10" Content="Computer" />
                </ComboBox>
                <ComboBox FontSize="18" Margin="0,10,0,10"  Grid.Row="3" Grid.Column="0" SelectionChanged="lbxPlayer2Type_SelectionChanged" x:Name="lbxPlayer2Type" Canvas.ZIndex="1400" >
                    <ComboBoxItem Padding="5,10,5,10" Content="Human" />
                    <ComboBoxItem Padding="5,10,5,10" Content="Computer" IsSelected="True"  />
                </ComboBox>
                
                <TextBox FontSize="18" x:Name="txtPlayer1Name" Grid.Row="2" Grid.Column="1"></TextBox>
                <TextBox FontSize="18" x:Name="txtPlayer2Name" Grid.Row="3" Grid.Column="1"></TextBox>
            </Grid>
        </Grid>
        <TextBlock x:Name="txtPlayerThinking" FontSize="18" FontWeight="Bold" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="260,90,40,0"></TextBlock>
    </Grid>
</phone:PhoneApplicationPage>